﻿#region Header

/*
Remote views based on linq
By

Pascal Hauser 
Dipl. Ing. in Informatik, Hochschule für Technik Rapperswil, 2006
Master Thesis, Hochschule für Technik Rapperswil, 2008-2010

and

Raphael Gfeller
Dipl. Ing. in Informatik, Hochschule für Technik Rapperswil, 2006
Master Thesis, Hochschule für Technik Rapperswil, 2008-2010

*/

#endregion

#region Usings

using System;
using System.Diagnostics;
using System.Globalization;
using System.Linq;

#endregion

namespace Sebarf.Diagnostics.Interfaces {
	/// <summary>
	/// simple impl of <see cref="ILogger"/>
	/// </summary>
	public class SimpleLoggerService : ILoggerService {
		#region Public Methods

		/// <summary>
		/// write message
		/// </summary>
		/// <param name="message"></param>
		public void WriteLogEntry(int priority, string message) {
			if (priority > 50) {
				Logger.WriteDebug(string.Concat(new StackTrace().GetFrames().Select(f => f + "\n").ToArray()));
			}
			string newMessage = string.Format("{0}\t{2}, {1}", DateTime.Now.ToString(CultureInfo.CurrentCulture), priority,
											   message);
			Console.WriteLine(newMessage);
			Debug.WriteLine(newMessage);
		}

		#endregion
	}
}